//
//  CateTopCell.swift
//  Spookiness
//
//  Created by 腾億 on 2017/12/12.
//  Copyright © 2017年 tml. All rights reserved.
//

import UIKit

class CateTopCell: UICollectionViewCell {
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.contentView.addSubview(self.iconView)
        setUpSnap()
        
        //对cell进行圆角切边处理
        self.contentView.setCornerRadius(radius: 5)
        self.contentView.layer.borderWidth = 1
        self.contentView.layer.borderColor = UIColor.lightGray.withAlphaComponent(0.5).cgColor
        self.contentView.layer.masksToBounds = true
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    fileprivate lazy var iconView: UIImageView = {
       let imgV = UIImageView()
        imgV.contentMode = .scaleAspectFill
        return imgV
    }()
    
    fileprivate func setUpSnap() {
        self.iconView.snp.makeConstraints { (make) in
            make.edges.equalToSuperview()
        }
    }
    
    var model: CateTopLisModel? {
        didSet{
            guard model != nil else {
                return
            }
            self.iconView.kf.setImage(urlString: model?.cover)
        }
    }
    
}
